import React, { Component } from 'react'
import { connect } from 'react-redux'


class Brother2 extends Component {

  render() {
    return (
      <div>
        Brother2
        <br/>
        <br/>
        <br/>
        仓库中最新的值---{this.props.count}---{this.props.name}
      </div>
    )
  }
}

// mapStateToProps 只要仓库中有任何的改变都会执行
const mapStateToProps = state => {
  console.log(state)

  // 这个返回的对象的值，会作为props传递给Brother2组件
  return {
    count: state.count,
    name: state.user
  }
}

export default connect(mapStateToProps, null)(Brother2)